package de.uebungen.grabo;

import java.awt.BorderLayout;
import java.awt.Color;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.JWindow;

@SuppressWarnings("serial")
public class Navigator extends JWindow {
	
	private JTextField tfPoints = new JTextField();
	
	private JButton btnNewGame = new JButton("New Game");
	
	public Navigator(JFrame parent) {
		super(parent);
		
		this.tfPoints.setEditable(false);
		
		JLabel lblPunktestand = new JLabel("Punktestand");
		lblPunktestand.setOpaque(true);
		lblPunktestand.setVisible(true);
		
		JPanel pnlBottom = new JPanel();
		pnlBottom.setLayout(new BorderLayout());
		pnlBottom.add(lblPunktestand, BorderLayout.NORTH);
		pnlBottom.add(this.tfPoints, BorderLayout.SOUTH);
		
		JPanel rahmen = new JPanel();
		rahmen.setLayout(new BorderLayout());
		rahmen.setBorder(BorderFactory.createLineBorder(new Color(120,136,128), 2));

		rahmen.add(new Tastatur(), BorderLayout.NORTH);
		rahmen.add(pnlBottom);
		rahmen.add(this.btnNewGame, BorderLayout.SOUTH);
		
		this.getContentPane().add(rahmen);

		this.updateLocation();
		this.pack();
		

		}
	
	public void updateLocation()
	{
		this.setLocation((int)this.getParent().getLocation().getX() + this.getParent().getWidth() + 550, 
				         (int)this.getParent().getLocation().getY());
	}
	
	public Hauptfenster getHauptfenster()
	{
		return (Hauptfenster)this.getParent();
	}
}
